{% extends './layout.html.twig' %}

{% block title %}Signals | Crypto Bot{% endblock %}

{% block content %}
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1>Signals</h1>
                    </div>
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-right">
                            <li class="breadcrumb-item"><a href="{{ '/' }}">Dashboard</a></li>
                            <li class="breadcrumb-item active">Signals</li>
                        </ol>
                    </div>
                </div>
            </div><!-- /.container-fluid -->
        </section>
        <!-- /.Content Header (Page header) -->

        <!-- Main content -->
        <div class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <!-- /.card-header -->
                            <div class="card-body table-responsive p-0">
                                <table class="table table-bordered table-sm table-hover">
                                    <thead>
                                    <tr>
                                        <th scope="col">Exchange</th>
                                        <th scope="col">Symbol</th>
                                        <th scope="col">Side</th>
                                        <th scope="col">Strategy</th>
                                        <th scope="col">Time</th>
                                        <th scope="col">State</th>
                                        <th scope="col">Options</th>
                                    </tr>

                                    </thead>
                                    <tbody>
                                    {% for signal in signals %}
                                        <tr>
                                            <td>{{ signal.exchange }}</td>
                                            <td><a target="blank" href="/tradingview/{{ signal.exchange }}:{{ signal.symbol }}">{{ signal.symbol }}</a></td>
                                            <td>
                                                {% if signal.side == 'long' %}
                                                    <i class="fas fa-chevron-circle-up text-success"></i>
                                                {% elseif signal.side == 'short' %}
                                                    <i class="fas fa-chevron-circle-down text-danger"></i>
                                                {% elseif signal.side == 'close' %}
                                                    <i class="fa fa-times" aria-hidden="true"></i>
                                                {% endif %}
                                            </td>
                                            <td>{{ signal.strategy }}</td>
                                            <td>{{ signal.income_at|date('d.m.y H:i') }}</td>
                                            <td>{{ signal.state }}</td>
                                            <td class="text-muted"><span class="span-md">{{ signal.options }}</span></td>
                                        </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                            <!-- /.card-body -->
                        </div>
                        <!-- /.card -->
                    </div>
                </div>
                <!-- /.row -->
            </div><!-- /.container-fluid -->
        </div>
        <!-- /.content -->
    </div>
{% endblock %}
